import request from '@/utils/request'

/**
 * 分页查询车辆
 */
export function getVehiclePage(params) {
  return request({
    url: '/vehicle/page',
    method: 'get',
    params
  })
}

/**
 * 根据客户ID查询车辆列表
 */
export function getVehicleListByCustomerId(customerId) {
  return request({
    url: `/vehicle/customer/${customerId}`,
    method: 'get'
  })
}

/**
 * 根据ID查询车辆
 */
export function getVehicleById(id) {
  return request({
    url: `/vehicle/${id}`,
    method: 'get'
  })
}

/**
 * 新增车辆
 */
export function addVehicle(data) {
  return request({
    url: '/vehicle',
    method: 'post',
    data
  })
}

/**
 * 更新车辆
 */
export function updateVehicle(data) {
  return request({
    url: '/vehicle',
    method: 'put',
    data
  })
}

/**
 * 删除车辆
 */
export function deleteVehicle(id) {
  return request({
    url: `/vehicle/${id}`,
    method: 'delete'
  })
}

